package com.ahsh1688.zhengshi.system.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ahsh1688.zhengshi.util.PageResult;
import com.ahsh1688.zhengshi.system.service.TblUserinfoService;
import com.ahsh1688.zhengshi.system.mapper.TblUserinfoMapper;
import com.ahsh1688.zhengshi.system.entity.TblUserinfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author 龙哥
 * @since 2023-12-19 15:11:57
 */
@Service
@Slf4j
public class TblUserinfoServiceImpl implements TblUserinfoService{

    @Autowired
    private TblUserinfoMapper tblUserinfoMapper;

    @Override
    public PageResult<TblUserinfo> findPage(TblUserinfo params) {
        Page<TblUserinfo> page = PageHelper.startPage(params);
        List<TblUserinfo> list = tblUserinfoMapper.findPage(params);
        PageResult<TblUserinfo> pageResult = new PageResult<>();
        pageResult.setContent(list);
        pageResult.setTotalElements(page.getTotal());
        return pageResult;
    }

    @Override
    public List<TblUserinfo> findList(TblUserinfo params) {
        return tblUserinfoMapper.findList();
    }

    @Override
    public TblUserinfo findById(Long id) {
        return tblUserinfoMapper.findById(id);
    }

    @Override
    public int insert(TblUserinfo tblUserinfo) {
        return tblUserinfoMapper.insert(tblUserinfo);
    }

    @Override
    public int update(TblUserinfo tblUserinfo) {
        return tblUserinfoMapper.update(tblUserinfo);
    }

    @Override
    public int delete(Long id) {
        return tblUserinfoMapper.delete(id);
    }

}